home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
CUJ9209.ARJ
/
1009077A
< prev
next >
Wrap
Text File
|
1992-05-11
|
828b
|
41 lines
short madaline_output(outputs, choice, A)
short A, outputs[];
char choice;
{
int i,
minus = 0,
plus = 0;
short result = -1;
/* use the AND method */
if(choice == 'a' ||
choice == 'A'){
result = 1;
for(i=0; i<A; i++)
if(outputs[i] == -1)
result = -1;
}
/* use the OR method */
if(choice == 'o' ||
choice == 'O'){
for(i=0; i<A; i++)
if(outputs[i] == 1)
result = 1;
}
/* use the Majority vote method */
if(choice == 'm' ||
choice == 'M'){
for(i=0; i<A; i++){
if(outputs[i] == 1) plus++;
if(outputs[i] == -1) minus++;
}
if(plus > minus) result = 1;
}
return(result);
} /* ends madaline_output */